<template>
  <!-- 访客记录-详情 -->
  <div>
    <public-modal
      width="1000px"
      :footer="false"
      title="详情页"
      modalStyle="detailModal"
      :publicVisible="publicVisible"
      cancelContext="拒绝"
      confirmContext="通过"
      @handleOk="handleOk"
      @cancel="cancel"
    >
      <div slot="content">
        <div class="common-title">
          <div class="icon"></div>
          <div class="content">手机信息:</div>
        </div>
        <div class="content-wrapper">
          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">IMEI码一</div>
              <div class="value common-value">{{ detail.imeiOne || '暂无' }}</div>
            </div>
            <div class="info-wrap f1">
              <div class="label common-lable">IMEI码二</div>
              <div class="value common-value">{{ detail.imeiTwo || '暂无' }}</div>
            </div>
          </div>
          <div class="flex"></div>

          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">手机型号</div>
              <div class="value common-value">{{ detail.phoneModule || '暂无' }}</div>
            </div>
          </div>
          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable" style="height: 100%">内容图片</div>
              <div class="value common-value" style="min-height: 46px">
                <template v-if="detail.imgList">
                  <img
                    :src="`${prefixImg}${item}`"
                    alt=""
                    @click="handlePreview(detail.imgList.map((item) => item))"
                    class="img-style-wrapper"
                    v-for="(item, index) in detail.imgList"
                    :key="index"
                  />
                </template>
                <template v-else>暂无 </template>
              </div>
            </div>
          </div>
        </div>

        <div class="common-title">
          <div class="icon"></div>
          <div class="content">所属人信息:</div>
        </div>
        <div class="content-wrapper">
          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">姓名</div>
              <div class="value common-value">{{ detail.belongingPersonName || '暂无' }}</div>
            </div>
            <div class="info-wrap f1">
              <div class="label common-lable">联系电话</div>
              <div class="value common-value">
                {{ detail.belongingPersonMobile || '暂无' }}
              </div>
            </div>
          </div>
          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">身份证号</div>
              <div class="value common-value">{{ detail.belongingPersonIdcard || '暂无' }}</div>
            </div>
            <div class="info-wrap f1">
              <div class="label common-lable">备案时间</div>
              <div class="value common-value">
                {{ detail.createTime || '暂无' }}
              </div>
            </div>
          </div>
        </div>

        <template v-if="detail.status === 1">
          <div class="common-title">
            <div class="icon"></div>
            <div class="content">挂失信息:</div>
          </div>
          <div class="content-wrapper">
            <div class="flex">
              <div class="info-wrap f1">
                <div class="label common-lable">丢失时间</div>
                <div class="value common-value">{{ detail.lossTime || '暂无' }}</div>
              </div>
              <div class="info-wrap f1">
                <div class="label common-lable">上报时间</div>
                <div class="value common-value">
                  {{ detail.lossReportTime || '暂无' }}
                </div>
              </div>
            </div>
            <div class="flex">
              <div class="info-wrap f1">
                <div class="label common-lable">丢失地点</div>
                <div class="value common-value">{{ detail.lossAddress || '暂无' }}</div>
              </div>
            </div>
            <div class="flex">
              <div class="info-wrap f1">
                <div class="label common-lable">报案派出所</div>
                <div class="value common-value">{{ detail.lossPoliceAgencyId || '暂无' }}</div>
              </div>
            </div>
          </div>
        </template>
      </div>
      <div slot="footer"></div>
    </public-modal>
  </div>
</template>
<script>
import startEndTime from '@/components/startEndTime'
import publicModal from '@/components/publicModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { machinePrintRecordDetails } from '@/api/api'
import moment from 'moment'
import { getPrefixImg, previewImage } from '../../../../utils/util'
import { phoneDetails } from '../../../../api/api'

export default {
  name: 'houseDetail',
  components: { publicModal, startEndTime },
  mixins: [JeecgListMixin],
  data() {
    return {
      prefixImg: getPrefixImg(),
      publicVisible: false,
      project_company_type: [],
      queryParams: { pageSize: 5 },
      ipagination: { pageSize: 5 },
      disableMixinCreated: true,
      isTsyfwinfo: {},
      policeHouseMainsList: {},
      companyMessage: {},
      machinePrintRecord: {},
      imageListUrl: [],
      detail: {},
    }
  },

  methods: {
    moment,
    async show(records) {
      this.publicVisible = true
      this.getDetail(records)
    },
    getDetail(records) {
      const params = {
        id: records.id,
      }
      phoneDetails(params).then((res) => {
        if (res.code == 200) {
          this.detail = res.result
        } else {
          this.$message.error(res.message)
        }
      })
    },
    handleOk() {
      this.publicVisible = false
    },

    cancel(target) {
      this.publicVisible = false
    },
    handlePreview(urls = []) {
      previewImage.call(this, urls)
    },
  },
}
</script>
<style scoped lang="less">
/deep/ .modalCotent {
  padding: 20px 40px;
  border-radius: 0 0 4px 4px;
}

.img-style-wrapper {
  width: 140px;
  height: 124px;
  border-radius: 8px 8px 8px 8px;
  object-fit: cover;
  margin-right: 10px;
  margin-bottom: 10px;
}
</style>
